<template>
	<u-popup :show="show" mode="bottom" @close='close' closeable :mask-close-able='false'>
		<view class="content">
			<view class="title">{{title}}</view>
			<view style="margin-top: 30rpx;">
				<u--textarea fixed='true' v-model="formModel.content" type='textarea' border='surround' maxlength='500' height='300rpx' :placeholder='placeholder' />
			</view>
			<view class="confirm" @click="confirm">确定</view>
		</view>
	</u-popup>
</template>

<script>
export default{
	components:{},
	data() {
		return {
			show: false,
			type: '',
			title: '',
			placeholder: '',
			formModel: {},
			fromRules: {},
			toUser: ''
		}
	},
	created() {
	},
	methods:{
		open(e){
			this.toUser = e
			if(e == 'suggest'){
				this.placeholder = '请输入内容...'
				this.title = '意见和建议'
			}else{
				this.placeholder = '请输入留言内容...'
				this.title = '留言互动'
			}
			this.show = true
			uni.hideTabBar()
		},
		close(){
			this.show = false
			uni.showTabBar()
		},
		//确认放入
		confirm(){
			console.log('放入', this.formModel)
			if(!this.formModel.content){
				this.$show.showMessage('内容不能为空')
				return
			}
			this.formModel.toUser = this.toUser
			this.$emit('confirm', this.formModel)
			this.close()
		},
	}
}
</script>

<style lang="scss" scoped>
	.content{
		min-height: 600rpx;
		padding: 0 30rpx;
		.title{
			margin-top: 30rpx;
			width: 100%;
			text-align: center;
			font-size: 34rpx;
			font-weight: bold;
			color: #333333;
		}
		.confirm{
			width: 600rpx;
			height: 88rpx;
			margin: 100rpx auto;
			line-height: 88rpx;
			font-size: 32rpx;
			text-align: center;
			background-color: #e153ce;
			color: #FFFFFF;
			border-radius: 44rpx;
			box-shadow: 10rpx 10rpx 10rpx rgba(0, 0, 0, 0.3);
		}
	}
</style>
